﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Noris.Tools.TraceVisualiser.Support
{
    /// <summary>
    /// Obecné dialogy s uživatelem.
    /// Jde o jednoduché přechody na metodu Windows (System.Windows.Forms.MessageBox.Show(...))
    /// </summary>
    public static class Dialog
    {
        public static void ShowInfo(string info)
        {
            MessageBox.Show(info, "Informace", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        public static void ShowWarning(string warning)
        {
            MessageBox.Show(warning, "Varování", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
        public static void ShowError(string error)
        {
            MessageBox.Show(error, "Chyba", MessageBoxButtons.OK, MessageBoxIcon.Stop);
        }
        public static void ShowError(Exception exc, string error)
        {
			string eol = Environment.NewLine;
			string text = error + eol + eol + exc.Message + eol + exc.StackTrace;
            MessageBox.Show(text, "Chyba", MessageBoxButtons.OK, MessageBoxIcon.Stop);
        }
        public static bool ShowQuestionYN(string query)
        {
            return ShowQuestionYN(query, true);
        }
        public static bool ShowQuestionYN(string query, bool initialResponse)
        {
            MessageBoxDefaultButton defaultButton = (initialResponse ? MessageBoxDefaultButton.Button1 : MessageBoxDefaultButton.Button2);
            DialogResult result = MessageBox.Show(query, "Dotaz", MessageBoxButtons.YesNo, MessageBoxIcon.Question, defaultButton);
            return (result == DialogResult.Yes);
        }
    }
}
